#include<cstdio>
#include<cstring>

using namespace std;

const int MAXN = 309000;
const int MAXM = 309000;

#define cnt2(x) cntttt[(x)+MAXN]
#define cnt1(x) cntt[(x)]

int ti[MAXN];
int h[MAXN],to[MAXN<<1],nx[MAXN<<1],cnt;
int top[MAXN],fa[MAXN],ch[MAXN],sz[MAXN],dep[MAXN];
int len[MAXM],begin[MAXM],end[MAXM],lca[MAXM];
int adt1[MAXN],adt2[MAXN],des1[MAXN],des2[MAXN];
int nxb[MAXN<<2],vb[MAXN<<2],cntb;
int n,m;
int cntt[MAXN<<2],cntttt[MAXN<<2],ans[MAXN];

int read(){
    int rt=0,fl=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')fl=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){rt=rt*10+ch-'0';ch=getchar();}
    return rt*fl;
}

void add_edge(int _u,int _v){
    to[++cnt]=_v;nx[cnt]=h[_u];h[_u]=cnt;
}

void link(int _u,int _v){
    add_edge(_u,_v);add_edge(_v,_u);
}

void dfs1(int _rt,int _pr){
//df    printf("%d %d\n",_rt,_pr);
    fa[_rt]=_pr;sz[_rt]=1;dep[_rt]=dep[_pr]+1;
    for(int i=h[_rt];i;i=nx[i]){
        if(to[i] == _pr)continue;
        dfs1(to[i],_rt);
        sz[_rt]+=sz[to[i]];
        if(sz[to[i]]>sz[ch[_rt]])ch[_rt]=to[i];
    }
}

void dfs2(int _rt,int _tp){
    top[_rt]=_tp;
    if(ch[_rt]!=0)dfs2(ch[_rt],_tp);
    for(int i=h[_rt];i;i=nx[i]){
        if(to[i]==fa[_rt] || to[i]==ch[_rt])continue;
        dfs2(to[i],to[i]);
    }
}

int get_lca(int _u,int _v){
    while(top[_u]!=top[_v])
        dep[top[_u]] > dep[top[_v]] ? _u=fa[top[_u]] : _v=fa[top[_v]];
    return dep[_u]>dep[_v]?_v:_u;
}

void init_data(){
    n=read();m=read();
    for(int i=1;i<n;i++){
        int a=read(),b=read();
        link(a,b);
    }
    dfs1(1,0);dfs2(1,1);
    for(int i=1;i<=n;i++){
        ti[i]=read();
    }
    for(int i=1;i<=m;i++){
        begin[i]=read();
        end[i]=read();
        lca[i]=get_lca(begin[i],end[i]);
        len[i] = dep[begin[i]] - dep[lca[i]] + dep[end[i]] - dep[lca[i]];
    //    printf("%d %d %d %d\n",begin[i],end[i],lca[i],len[i]);
    } 
}

void add_ins_tag_1(int _x,int _v){
    cntb++;
    nxb[cntb] = adt1[_x];
    adt1[_x] = cntb;
    vb[cntb] = _v;
}

void add_des_tag_1(int _x,int _v){
    cntb++;
    nxb[cntb] = des1[_x];
    des1[_x] = cntb;
    vb[cntb] = _v;
}

void add_ins_tag_2(int _x,int _v){
    cntb++;
    nxb[cntb] = adt2[_x];
    adt2[_x] = cntb;
    vb[cntb] = _v;
}

void add_des_tag_2(int _x,int _v){
    cntb++;
    nxb[cntb] = des2[_x];
    des2[_x] = cntb;
    vb[cntb] = _v;
}

void init_map(){
    for(int i=1;i<=m;i++){
        add_ins_tag_1(begin[i],dep[begin[i]]);
        add_des_tag_1(fa[lca[i]],dep[begin[i]]);
        add_ins_tag_2(end[i],dep[end[i]] - len[i]);
        add_des_tag_2(lca[i],dep[end[i]] - len[i]);
    }
}

void solve(int _x){
    ans[_x] = -cnt1(dep[_x]+ti[_x])-cnt2(dep[_x]-ti[_x]);
    for(int i=h[_x];i;i=nx[i]){
        if(to[i]==fa[_x])continue;
        solve(to[i]);
    }
    for(int i=adt1[_x];i;i=nxb[i]){
  //      printf("adt1 %d %d\n",_x,vb[i]);
        cnt1(vb[i])++;
    }
    for(int i=des1[_x];i;i=nxb[i]){
  //              printf("des1 %d %d\n",_x,vb[i]);

        cnt1(vb[i])--;
    }
    for(int i=adt2[_x];i;i=nxb[i]){ //       printf("adt2 %d %d\n",_x,vb[i]);

        cnt2(vb[i])++;
    }
    for(int i=des2[_x];i;i=nxb[i]){ //       printf("des2 %d %d\n",_x,vb[i]);

        cnt2(vb[i])--;
    }
 //   printf("%d %d %d %d %d\n",_x,dep[_x]+ti[_x],cnt1(dep[_x]+ti[_x]),dep[_x]-ti[_x],cnt2(dep[_x]-ti[_x]));
    ans[_x] += cnt1(dep[_x]+ti[_x]) + cnt2(dep[_x]-ti[_x]);
}

int main(){
//    freopen("running3.in","r",stdin);
//    freopen("unning.out","w",stdout);
    init_data();
    init_map();
    solve(1);
    for(int i=1;i<=n;i++){
        printf("%d ",ans[i]);
    }
    return 0;
}
